package com.controller;

import com.domain.Book;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/books")
public class BookController {
    @PostMapping
    public String save(@RequestBody Book book){
        System.out.println("book save ...");
        return ("{'module':'book save'}");
    }

    @DeleteMapping("/{id}")
    public String delete(@PathVariable Integer id){
        System.out.println("book delete ...");
        return ("{'module':'book delete'}");
    }

    @PutMapping
    public String update(@RequestBody Book book){
        System.out.println("book update ...");
        return ("{'module':'book update'}");
    }



    @GetMapping("/{id}")
    public String getById(@PathVariable Integer id){
        System.out.println("book getById ...");
        return ("{'module':'book getById'}");
    }

    @GetMapping
    public String getAll(){
        System.out.println("book getAll ...");
        return ("{'module':'book getAll'}");
    }

}
